package com.whmskj.xjlhsc.mobie.Scheduling.controller;

import com.whmskj.xjlhbc.domain.Yg01employeefiles;
import com.whmskj.xjlhsc.controller.vo.Result;
import com.whmskj.xjlhsc.entity.Managementofxt03;
import com.whmskj.xjlhsc.mobie.Scheduling.Dto.DcSchedulingQueryDto;
import com.whmskj.xjlhsc.mobie.Scheduling.Dto.DevicePlatformChangeDto;
import com.whmskj.xjlhsc.mobie.Scheduling.Dto.GetProductDeviceDto;
import com.whmskj.xjlhsc.mobie.Scheduling.Dto.UpdatePersonExchangeDto;
import com.whmskj.xjlhsc.mobie.Scheduling.entity.vo.DcSchedulingVo;
import com.whmskj.xjlhsc.mobie.empProPlan.service.ProPersonnelStandConfirmService;
import com.whmskj.xjlhsc.service.Managementofxt03Service;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author: Sakura
 * @Date: 2025/8/30 9:25
 * @Version: v1.0.0
 * @Description: TODO
 **/
// 挡车排班总览
@RestController
@RequestMapping("/mob/dcScheduling")
@Tag(description = "挡车排班接口", name = "挡车排班接口")
public class DcSchedulingController {
    @Autowired
    private ProPersonnelStandConfirmService proPersonnelStandConfirmService;

    @Autowired
    private Managementofxt03Service managementofxt03Service;
    @Operation(description = "挡车排版列表显示")
    @PostMapping("/list")
    public Result list(@RequestBody DcSchedulingQueryDto queryDto) {
      List<DcSchedulingVo> list = proPersonnelStandConfirmService.DcSchedulingList(queryDto);
        return Result.success(list);
    }
    @Operation(description = "获取运转班上班日期")
    @GetMapping("/getSchedulingDate")
    public Result getSchedulingDate(@RequestParam(required = false)String process,
                                    @RequestParam(required = false)String startTime,
                                    @RequestParam(required = false)String endTime) {
        return Result.success(proPersonnelStandConfirmService.getSchedulingDate(process,startTime,endTime));
    }
    @Operation(description = "删除排班信息")
    @DeleteMapping("{id}")
    public Result delete(@PathVariable Long id) {
        proPersonnelStandConfirmService.deleteConfirm(id);
        return Result.success();
    }
    @Operation(description = "产量机台显示")
    @PostMapping("getProductDevice")
    public Result getProductDevice(@RequestBody GetProductDeviceDto getProductDeviceDto) {
        return Result.success(proPersonnelStandConfirmService.getProductDevice(getProductDeviceDto));
    }
    @Operation(description = "产量机台机组显示")
    @PostMapping("getProductDeviceGroup")
    public Result getProductDeviceGroup(@RequestBody GetProductDeviceDto getProductDeviceDto) {
        return Result.success(proPersonnelStandConfirmService.getProductDeviceGroup(getProductDeviceDto));
    }


    @Operation(description = "保存排班调整")
    @PostMapping("saveDevicePlatChange")
    public Result saveDevicePlatChange(@RequestBody DevicePlatformChangeDto devicePlatformChangeDto) {
        proPersonnelStandConfirmService.saveDevicePlatChange(devicePlatformChangeDto);
        return Result.success();
    }

    @Operation(description = "获取人员调整列表")
    @GetMapping("getPersonExchangeList")
    public Result getPersonExchangeList(@RequestParam(required = false) String keyWord) {
     List<Yg01employeefiles> list = proPersonnelStandConfirmService.getPersonExchangeList(keyWord);
     return Result.success(list);
    }
    @Operation(description = "人员调整")
    @PutMapping("updatePersonExchange")
    public Result updatePersonExchange(@RequestBody UpdatePersonExchangeDto updatePersonExchangeDto){
        proPersonnelStandConfirmService.updatePersonExchange(updatePersonExchangeDto);
        return Result.success();
    }

    @GetMapping("getTypeOfWorkList")
    @Operation(description = "获取工种列表")
    public Result getTypeOfWorkList(@RequestParam Integer isProduct){
      List<Managementofxt03> list = managementofxt03Service.getTypeOfWorkList(isProduct);
      return Result.success(list);
    }

}